home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TPUG - Toronto PET Users Group
/
TPUG Users Group CD
/
TPUG Users Group CD.iso
/
COMAL
/
B-Book Series
/
(k)b1.d64
/
fetch.l
< prev
next >
Wrap
Text File
|
2007-02-28
|
1KB
|
44 lines
9000 //
9010 PROC FETCH(REF A$,V$,MAX) CLOSED
9030 DIM VALID$ OF 40, B$ OF 1
9040 // IF V$ = "A" THEN THE ALPHABET IS USED (PLUS SPACE)
9050 // IF V$ = "D" THEN THE DIGITS ARE USED
9060 // IF V$ = "B" THEN BOTH ALPHABET AND DIGITS ARE USED (PLUS SPACE)
9070 // OTHERWISE VALID$ IS SET TO THE VALUE AS SENT
9080 // NOTE: >>> CARRIAGE RETURN AND DELETE KEY ARE ADDED TO VALID$
9090 Z:=ZONE
9100 ZONE 0
9110 A$:=""
9120 CASE V$ OF
9130 WHEN "A"
9140 VALID$:="ABCDEFGHIJKLMNOPQRSTUVWXYZ "
9150 WHEN "D"
9160 VALID$:="0123456789"
9170 WHEN "B"
9180 VALID$:="ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789"
9190 OTHERWISE
9200 VALID$:=V$
9210 ENDCASE
9220 DONE:=FALSE; NUM:=0
9230 REPEAT
9240 GET'VALID(B$,VALID$+CHR$(13)+CHR$(20))
9250 CASE B$ OF
9260 WHEN CHR$(13) // CARRIAGE RETURN
9270 DONE:=TRUE
9280 WHEN CHR$(20) // DELETE KEY
9290 IF NUM THEN // ONLY DO IF ALREADY HAVE SOMETHING
9300 NUM:-1 // MINUS ONE FOR NUMBER IN STRING
9310 PRINT "¥ ¥", // CURSOR LEFT SPACE CURSOR LEFT
9320 A$:=A$(1:NUM)
9330 ENDIF
9340 OTHERWISE // ALL OTHER VALID CHARACTERS
9350 IF NUM<MAX THEN // DON'T GO PAST MAXIMUM
9360 A$:=A$+B$ // ADD CHARACTER TO THE STRINGRETURN NEEDED
9370 NUM:+1 // ADD 1 TO THE COUNT OF CHARACTERS
9380 PRINT B$, // PRINT THE CHARACTER
9390 ENDIF
9400 ENDCASE
9410 UNTIL DONE
9420 ZONE Z
9430 ENDPROC FETCH